When I auto-start Supervisord on boot, the [program:start_gunicorn] don't start

Posted by Charlesliam on Server Fault See other posts from Server Fault or by Charlesliam
Published on 2014-06-11T02:18:27Z Indexed on 2014/06/11 3:28 UTC
Read the original article Hit count: 235

Filed under:
|
|
|

The [program:start_gunicorn] is running with no error when I manually start supervisord with this setup.

[program:start_gunicorn]
command=/env/nafd/bin/gunicorn_start    
priority=1                    
autostart=true                
autorestart=unexpected       
user=nafd_it                  
redirect_stderr=true        
stdout_logfile=/env/nafd/logs/gunicorn_supervisor.log     
stderr_logfile=/env/nafd/logs/gunicorn_supervisor_err.log 

I successfully run this init script for my supervisord. But when I used auto-start init script for supervisord the gunicorn is not running.

]# service gunicorn status
gunicorn: unrecognized service

What do I need to do to make the [program:start_gunicorn] run when using auto-start supervisord on boot?

Here's my gunicorn config.

/env/nafd/bin/gunicorn_start

#!/bin/bash

NAME="nafd_proj"
DJANGODIR=/env/nafd/nafd_proj
SOCKFILE=/env/nafd/run/gunicorn.sock
NUM_WORKERS=1
DJANGO_SETTINGS_MODULE=nafd_proj.settings
DJANGO_WSGI_MODULE=nafd_proj.wsgi

echo "Starting $NAME as 'NAFD Web Server'"

source /env/nafd/bin/activate

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH

RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR

cd /env/nafd/nafd_proj

exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application --bind=127.0.0.1:8001 \
  --name $NAME \
  --workers $NUM_WORKERS \
  --log-level=debug \`

Any idea is really appreciated.

© Server Fault or respective owner

Related posts about init.d

Related posts about supervisord